<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.opengis.net/cat/csw" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" xmlns:csw="http://www.opengis.net/cat/csw" elementFormDefault="qualified" version="2.0.0" id="csw-publication">
	<xsd:annotation>
		<xsd:appinfo>
			<dc:identifier xmlns:dc="http://www.purl.org/dc/elements/1.1/">
         http://schemas.opengis.net/csw/2.0.0/publication
         </dc:identifier>
		</xsd:appinfo>
		<xsd:documentation xml:lang="en">
         This schema defines the request and response messages for the 
         CSW-Publication interface specified in OGC-04-021, clause 10.
      </xsd:documentation>
	</xsd:annotation>
	<xsd:include schemaLocation="CSW-discovery.xsd"/>
	<!-- ================================================================== -->
	<!-- =   Transaction Request and Response                             = -->
	<!-- ================================================================== -->
	<!-- REQUEST -->
	<xsd:element name="Transaction" type="csw:TransactionType" id="Transaction"/>
	<xsd:complexType name="TransactionType" id="TransactionType">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
            Users may insert, update, or delete catalogue entries.
            verboseResponse - if "true", affected records are 
                              identified in the response
         </xsd:documentation>
		</xsd:annotation>
		<xsd:complexContent>
			<xsd:extension base="csw:RequestBaseType">
				<xsd:sequence>
					<xsd:choice maxOccurs="unbounded">
						<xsd:element name="Insert" type="csw:InsertType"/>
						<xsd:element name="Update" type="csw:UpdateType"/>
						<xsd:element name="Delete" type="csw:DeleteType"/>
					</xsd:choice>
				</xsd:sequence>
				<xsd:attribute name="verboseResponse" type="xsd:boolean" use="optional" default="false"/>
				<xsd:attribute name="requestId" type="xsd:anyURI" use="optional"/>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>
	<xsd:complexType name="InsertType" id="InsertType">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
            Submits one or more records to the catalogue.
            handle - a local identifier for the action (unique within
                     the transaction)
         </xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element ref="csw:AbstractRecord" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="handle" type="xsd:ID" use="optional"/>
	</xsd:complexType>
	<xsd:complexType name="UpdateType" id="UpdateType">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
         Updates one or more catalogue records or parts of a catalog record.
         The properties to be modified are specified by the including a record
         instance or by specifying parts of a record to be modified using the
         RecordProperty element.
         The scope of the operation, that is the number of records affected
         by the operation, is controled by the specified constraint.
         handle   - a local identifier for the action
         </xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:choice>
				<xsd:element ref="csw:AbstractRecord"/>
				<xsd:element ref="csw:RecordProperty" maxOccurs="unbounded"/>
			</xsd:choice>
			<xsd:element ref="csw:Constraint" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="handle" type="xsd:ID" use="optional"/>
	</xsd:complexType>
	<xsd:complexType name="DeleteType" id="DeleteType">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
            Deletes one or more catalogue items
            that satisfy some constraints
         </xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element ref="csw:Constraint" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="typeName" type="xsd:anyURI" use="optional"/>
		<xsd:attribute name="handle" type="xsd:ID" use="optional"/>
	</xsd:complexType>
	<xsd:element name="RecordProperty" type="csw:RecordPropertyType">
		<xsd:annotation>
			<xsd:documentation>
            The RecordProperty element is used to specify the new
            value of a record property inside an Update element.
         </xsd:documentation>
		</xsd:annotation>
	</xsd:element>
	<xsd:complexType name="RecordPropertyType">
		<xsd:sequence>
			<xsd:element name="Name" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation>
                  The Name element contains the name of a property
                  to be updated.  The name may be a path expression.
               </xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="Value" type="xsd:anyType" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>
                  The Value element contains the replacement value for the
                  named property.
               </xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:element name="TransactionResponse" type="csw:TransactionResponseType" id="TransactionResponse"/>
	<xsd:complexType name="TransactionResponseType">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
            The response for a transaction request that was successfully
            completed. If the transaction failed for any reason, a 
            TransactionFailure exception is returned instead.
         </xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="TransactionSummary" type="csw:TransactionSummaryType"/>
			<xsd:element name="InsertResult" type="csw:TransactionResultType" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="version" type="xsd:string" use="optional"/>
	</xsd:complexType>
	<xsd:complexType name="TransactionSummaryType" id="TransactionSummaryType">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
            Reports the total number of catalogue items affected by some kind 
            of write action (i.e, insert, update, delete). If the client did 
            not specify a requestId, the server may assign one (a URI)
         </xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="totalInserted" type="xsd:nonNegativeInteger" minOccurs="0"/>
			<xsd:element name="totalUpdated" type="xsd:nonNegativeInteger" minOccurs="0"/>
			<xsd:element name="totalDeleted" type="xsd:nonNegativeInteger" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="requestId" type="xsd:anyURI" use="optional"/>
	</xsd:complexType>
	<xsd:complexType name="TransactionResultType" id="TransactionResultType">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
            Returns a "brief" view of the catalogue items affected by
            some write action. The handle attribute may reference a
            particular action in the corresponding transaction request.
         </xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element ref="csw:AbstractRecord" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="handleRef" type="xsd:anyURI" use="optional"/>
	</xsd:complexType>
	<!-- ================================================================== -->
	<!-- =   Harvest Request and Response                                 = -->
	<!-- ================================================================== -->
	<!-- REQUEST -->
	<xsd:element name="Harvest" type="csw:HarvestType" id="Harvest"/>
	<xsd:complexType name="HarvestType">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
            Requests that the catalogue attempt to harvest a resource from some 
            network location identified by the source URL.

            Source          - a URL from which the resource is retrieved
            ResourceType    - a URI that specifies the type of the resource
                              (DCMES v1.1) being harvested if it is known.
            ResourceFormat  - a media type indicating the format of the 
                              resource being harvested.  The default is 
                              "text/xml".
            ResponseHandler - a reference to some endpoint to which the 
                              response shall be forwarded when the
                              harvest operation has been completed
            HarvestInterval - an interval expressed using the ISO 8601 syntax; 
                              it specifies the interval between harvest 
                              attempts (e.g., P6M indicates an interval of 
                              six months).
         </xsd:documentation>
		</xsd:annotation>
		<xsd:complexContent>
			<xsd:extension base="csw:RequestBaseType">
				<xsd:sequence>
					<xsd:element name="Source" type="xsd:anyURI"/>
					<xsd:element name="ResourceType" type="xsd:anyURI" minOccurs="0"/>
					<xsd:element name="ResourceFormat" type="xsd:string" default="text/xml" minOccurs="0"/>
					<xsd:element name="HarvestInterval" type="xsd:duration" minOccurs="0"/>
					<xsd:element name="ResponseHandler" type="xsd:anyURI" minOccurs="0" maxOccurs="unbounded"/>
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>
	<!-- RESPONSE -->
	<!-- csw:Acknowledgement -->
	<!-- The Harvest operation can response in one of two ways depending on
        the presence or absence of the responseHandler attribute.

        If the responseHandler attribute it present, then the CSW server should
        verify the request syntax and immediately response to the client
        with a csw:Acknowledgement message.  Later, after the server
        has processed the request, it should generate a HarvestResponse
        message and send it to the location specified by the ResponseHandler 
        element using the indicated protocol scheme (e.g. ftp, mailto, http).
 
        If the responseHandler attribute is not present, then the CSW server
        should process the harvest request immediately and respond with a 
        HarvestResponse message.
   -->
	<xsd:element name="HarvestResponse" type="csw:HarvestResponseType" id="HarvestResponse">
		<xsd:annotation>
			<xsd:documentation xml:lang="en">
         If the harvest attempt is successful, the response includes
         summary representations of the newly created catalogue item(s).
         </xsd:documentation>
		</xsd:annotation>
	</xsd:element>
	<xsd:complexType name="HarvestResponseType" id="HarvestResponseType">
		<xsd:choice>
			<xsd:element ref="csw:Acknowledgement"/>
			<xsd:element ref="csw:TransactionResponse"/>
		</xsd:choice>
	</xsd:complexType>
</xsd:schema>
